package com.seashell.appstartupjob.enums;

import com.seashell.appstartupjob.exceptions.JobConfigNotCorrectException;

/**
 * com.seashell.appstartupjob.enums.CopyType
 * 复制的时候如果重复采取的行为
 *
 * @author Allen
 * @version v1.0
 * @date 2017/7/10
 */
public enum CopyType {
    /**
     * 忽略
     */
    IGNORE("ignore"),
    /**
     * 覆盖
     */
    OVERRIDE("override");

    private String value;

    CopyType(String value){
        this.value = value;
    }

    public static CopyType parse(String copyType){
        if(IGNORE.value.equalsIgnoreCase(copyType)){
            return IGNORE;
        }else if(OVERRIDE.value.equalsIgnoreCase(copyType)){
            return OVERRIDE;
        }else{
            throw new JobConfigNotCorrectException("copy type :"+copyType+" is not support");
        }
    }
}
